Skip to content

Conversation

oliveror
Copy link
Member

@oliveror oliveror commented Nov 16, 2026 •

Changes

After review: the original finding behind #82 was wrong. The title link's ::after overlay (RecipeCard.css) already stretches over the whole card, so clicking the image already opened the recipe. I confirmed this in a real browser on dev (document.elementFromPoint at the image centre is the title link, and clicking navigates).

  • Net result of this PR: test only. RecipeCard is restored exactly as on dev (the extra aria-hidden image link is gone, so meaningful image alt text from other consumers stays available to screen readers).
  • New Playwright smoke test: clicking the centre of a card image opens the recipe. It runs in a real browser because jsdom cannot hit-test CSS overlays, which is why the earlier unit test could not catch the problem.

Validation

  • npm run check passes; the new browser test passes.

Thanks @olestan for the review.

AI usage

Written with Claude Code (Anthropic) to address a teammate's review of the final-delivery findings. Please review the diff as you would any other contribution.

Closes #82

Only the title link opened a recipe; clicking the image did nothing. Wrap
the image in a link to the same page that is hidden from assistive
technology and the tab order, so keyboard and screen-reader users still
get a single link per card. Both links keep the browse state for Back.

Closes #82
Copy link
Member

@olestan olestan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting changes for two reasons:

  1. Redundant image link: The existing .recipe-card__title-link::after overlay already covers the entire card, including the image. Clicking the image should therefore already navigate through the title link, while the new image link remains covered by the overlay. The new unit test doesn't catch this because jsdom doesn't perform CSS hit-testing.

  2. Accessibility regression: Setting aria-hidden="true" on the image link also hides potentially meaningful image alt text provided by other consumers from screen readers.

I'd suggest verifying the original issue in a real browser before adding another link, and ensuring descriptive alt text remains accessible.

Review on #90 was right: the title link's ::after overlay already covers
the whole card, so clicking the image already opened the recipe (checked
in a real browser). The extra aria-hidden image link was redundant and
hid the image alt text from screen readers. Restore RecipeCard as before
and add a browser test that clicks the image centre, since jsdom cannot
hit-test the CSS overlay.

Closes #82
@oliveror oliveror changed the title fix(recipe): open the recipe when its card image is clicked test(recipe): verify that clicking a card image opens the recipe Nov 16, 2026
@oliveror
Copy link
Member Author

Thanks — you were right on both points. I checked on dev in a real browser: the element at the image centre is the title link's ::after overlay, and clicking it already navigates. I've reverted the image link (so alt text is exposed again as before) and replaced the jsdom tests with a Playwright test that clicks the image centre. The PR is now test-only; title and description updated.

@oliveror oliveror merged commit 618cd08 into dev Nov 16, 2026
2 checks passed
oliveror added a commit that referenced this pull request Nov 16, 2026
…ts (#96)

* fix(recipe): open the recipe when its card image is clicked

Only the title link opened a recipe; clicking the image did nothing. Wrap
the image in a link to the same page that is hidden from assistive
technology and the tab order, so keyboard and screen-reader users still
get a single link per card. Both links keep the browse state for Back.

Closes #82

* feat(perf): cache images and assets, serve image thumbnails

- Images: replace Cache-Control no-store with no-cache plus a strong ETag
  (public/private by recipe visibility). The access check still runs on
  every request, so privacy changes apply immediately, but unchanged
  images are answered with an empty 304 instead of being re-downloaded.
- Thumbnails: the API generates 480/800 px WebP variants (?w=) with sharp
  on first request and caches them under UPLOAD_DIR/variants; cleanup
  removes them with the original. Recipe cards use srcset/sizes.
  A seed image goes from 133.6 KB to 18.2 KB at 480 px.
- Apache: immutable one-year caching for hashed /assets, no-cache for
  index.html (deploy/apache.conf, needs mod_headers on the VM).
- Fallback image resized to 800 px: 173.4 KB -> 51.2 KB.
- GraphQL responses keep no-store.

Closes #70

* feat(images): normalise uploads on the server and cover all variants

Following team review of #70:
- Every upload is processed with sharp on the server, whatever the client
  sent: EXIF auto-rotation, at most 1600 px on the longest side, WebP
  quality 80, metadata (e.g. GPS) dropped. Quotas use the stored size.
  Existing files and URLs are unchanged.
- Card variants (480/800 px) are built at upload time; older images still
  get them lazily. The recipe detail image now uses srcset/sizes too.
- The global storage limit counts variant files. Variants already go
  through the same authorization (incl. privacy changes) and cleanup.

Refs #70

* test(recipe): cover card image clicks instead of adding a second link

Review on #90 was right: the title link's ::after overlay already covers
the whole card, so clicking the image already opened the recipe (checked
in a real browser). The extra aria-hidden image link was redundant and
hid the image alt text from screen readers. Restore RecipeCard as before
and add a browser test that clicks the image centre, since jsdom cannot
hit-test the CSS overlay.

Closes #82

* fix(images): refresh replaced images, rotate variants, remove orphans

Review on #96:
- ETags include the original's size and mtime, and cached variants are
  rebuilt when the original is newer, so re-seeded images (same
  filenames) are never shown stale.
- Variants apply EXIF auto-rotation, so older JPEG uploads stored before
  server-side normalisation are not shown sideways.
- Cleanup removes variants (and interrupted .tmp writes) whose original
  no longer exists, so they stop counting against the storage limit.

Refs #70
@oliveror oliveror deleted the fix/recipe-card-image-link branch November 17, 2026 00:30
Sign in to join this conversation on GitHub.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants